package com.app.ytong.bean;


import com.alibaba.fastjson.annotation.JSONField;

import java.util.ArrayList;
import java.util.List;

public class GoodsTimeListBean extends BaseListBean {


    private ArrayList<GoodsTimeListData> list = new ArrayList<GoodsTimeListData>();

    public ArrayList<GoodsTimeListData> getList() {
        return list;
    }

    public void setList(ArrayList<GoodsTimeListData> list) {
        this.list = list;
    }

    @JSONField(serialize = false)
    public void addListBean(GoodsTimeListBean listbean) {
        if (listbean == null)
            return;
        if (this.getCurrentPage() == INIT_PAGE) {
            setList(listbean.getList());
        } else {
            if (list == null)
                list = new ArrayList<GoodsTimeListData>();
            list.addAll(listbean.getList());
        }
        setListBeanData(listbean);
    }

    @JSONField(serialize = false)
    public List<String> getAllName(){
        List<String> nameList = new ArrayList<>();
        for(GoodsTimeListData data : list){
            nameList.add(data.getYna());
        }
        return nameList;
    }

    @JSONField(serialize = false)
    public String getYidByName(String name){
        for (GoodsTimeListData data : list){
            if(name.equals(data.getYna())){
                return data.getYid();
            }
        }
        return "";
    }


}
